package com.oamicnet.boot.config.controller;

import com.oamicnet.boot.config.config.MyAppProperties;
import com.oamicnet.boot.config.config.MyConfig;
import com.oamicnet.boot.config.entity.Student;
import com.oamicnet.boot.config.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConfigController {

    @Autowired
    private MyAppProperties myAppProperties;

    @Autowired
    private MyConfig myConfig;

    @Autowired
    private Student student;

    @Autowired
    private UserService userService;

    @GetMapping("/student-info")
    public String studentInfo() {
        return student.toString();
    }

    @GetMapping("/myconfig")
    public String getConfig() {
        return myConfig.getName() + " - " + myConfig.getVersion();
    }

    @GetMapping("/print")
    public String print() {
        System.out.println(myAppProperties);
        return "Hello World";
    }
}
